<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>Get方式调用Api的界面</title>
<script type="text/javascript" src="<%=basePath %>admin/assets/js/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="<%=basePath %>admin/assets/js/BackOffice/base64.js"></script></head>
<script src="<%=basePath %>api/test/ziyuan/c.js" type="text/javascript"></script>
<link href="<%=basePath %>api/test/ziyuan/s.css" type="text/css" rel="stylesheet"></link>
<style type="text/css">
 #miwen{
	width: 99%;
    height: 120px;
}
#jiemi{
width: 99%;
    height: 120px;
} 
</style>




<body>
	调用URL<br>
	
	<input id="parameters" style="width: 100%;" value="<%=basePath %>api/"/>
	<input type="button" id="submit" value="转换密文" onclick="zhuanhuan()"></input>
	<input type="button" id="submit" value="一键调用" onclick="zhuanhuan(1)"></input>
	<br>
	<input id="jiamipar" style="width: 100%;" value="<%=basePath %>api/"/>
	<input type="button" id="submit" value="调用接口" onclick="chufa()"></input>
	<br>
	返回的加密报文：<br>
	<textarea rows="20" cols="100" id="miwen"></textarea>
	<br>
	
	<input type="button" id="submit" value="解密报文" onclick="jiemi()"></input>
	<br>
	解密后报文：<br>
	<div class="HeadersRow">
  <textarea id="RawJson">
  </textarea>
</div>
<div id="ControlsRow">
  <input type="Button" value="格式化" onclick="Process()"/>
  <span id="TabSizeHolder">
    缩进量
    <select id="TabSize" onchange="TabSizeChanged()">
      <option value="1">1</option>
      <option value="2" selected="true">2</option>
      <option value="3">3</option>
      <option value="4">4</option>
      <option value="5">5</option>
      <option value="6">6</option>
    </select>
  </span>
  <label for="QuoteKeys">
    <input type="checkbox" id="QuoteKeys" onclick="QuoteKeysClicked()" checked="true" /> 
    引号
  </label>&nbsp; 
  <a href="javascript:void(0);" onclick="SelectAllClicked()">全选</a>
  &nbsp;
  <span id="CollapsibleViewHolder" >
      <label for="CollapsibleView">
        <input type="checkbox" id="CollapsibleView" onclick="CollapsibleViewClicked()" checked="true" /> 
        显示控制
      </label>
  </span>
  <span id="CollapsibleViewDetail">
    <a href="javascript:void(0);" onclick="ExpandAllClicked()">展开</a>
    <a href="javascript:void(0);" onclick="CollapseAllClicked()">叠起</a>
    <a href="javascript:void(0);" onclick="CollapseLevel(3)">2级</a>
    <a href="javascript:void(0);" onclick="CollapseLevel(4)">3级</a>
    <a href="javascript:void(0);" onclick="CollapseLevel(5)">4级</a>
    <a href="javascript:void(0);" onclick="CollapseLevel(6)">5级</a>
    <a href="javascript:void(0);" onclick="CollapseLevel(7)">6级</a>
    <a href="javascript:void(0);" onclick="CollapseLevel(8)">7级</a>
    <a href="javascript:void(0);" onclick="CollapseLevel(9)">8级</a>
  </span>
</div>
<div id="Canvas" class="Canvas"></div>
<!-- 	<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script> -->
<script type="text/javascript" src="<%=basePath %>api/test/ziyuan/m.js"></script>
</body>
<script type="text/javascript">

	
	function zhuanhuan(str) {

		var url = $("#parameters").val();
		var action = url;
		var parm = "";
		var actionIndex = $("#parameters").val().indexOf(".action?");
		if (actionIndex > 0) {

			action = $("#parameters").val().substr(0,
					$("#parameters").val().indexOf(".action?") + 7);

			parm = $("#parameters").val().substr(
					$("#parameters").val().indexOf(".action?") + 8,
					$("#parameters").val().length);

			$.ajax({
				url : "api/method_jiaMi.action",
				type : 'POST',
				data : {
					data : parm
				},
				success : function(data) {
					$("#jiamipar").val(action + "?r=" + data);
					if (str == "1")
						chufa(str);
				}
			});
		} else {
			$("#jiamipar").val(url);
			chufa(str);
		}
	}

	function chufa(str) {
		$.ajax({
			url : $("#jiamipar").val(),
			type : 'POST',
			success : function(data) {
				$("#miwen").text(data);
				if (str == "1")
					jiemi("1");
			}
		});

	}

	function jiemi(str) {
		$.ajax({
			url : "api/method_jieMi.action",
			type : 'POST',
			data : {
				data : $("#miwen").val()
			},
			success : function(data) {
				$("#RawJson").text(data);

				if (str == "1")
					CollapsibleViewClicked();
			}
		});

	}
</script>
</html>
